#pragma once
#include <Rz/Object.h>
#include <Rz/Graphics/Render/IArrayBuffer.h>
#include "API/GLDefinitions.h"

RZ_CLASS_FWD_DECL3(Rz, Graphics, Render, IRenderDevice);

namespace Rz { namespace Graphics { namespace Render { namespace Libraries { namespace OpenGL {

class GLArrayBuffer :
	public Object,
	virtual public IArrayBuffer
{
	public:
		RZ_RTTI(Rz::Graphics::Render::Libraries::OpenGL, GLArrayBuffer);
		RZ_RTTI_IMPLEMENTS(Object, IArrayBuffer);
		RZ_RTTI_END;

		GLArrayBuffer(IRenderDevice* renderDevice, BufferObjectType type);
		virtual ~GLArrayBuffer();

		virtual void GetData(void* data, u32 count, u32 startIndex) const override;
		virtual void SetData(const void* data, u32 dataLength, u32 startIndex, u32 offsetInBytes) override;

		virtual void Bind() override;
		virtual void Unbind() override;

	private:
		static GLenum TranslateBufferType(BufferObjectType bufferObjectType);

		GLenum _usageHint;
		GLenum _nativeBufferType;
		GLuint _bufferHandle;
};

} } } } }
